﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ctrl="clr-namespace:Tum.PDE.LanguageDSL.Visualization.View.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="DiagramItemStyle.xaml"/>
        <ResourceDictionary Source="Compartment.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <!-- ShapeClassElementStyle. -->
    <Style TargetType="{x:Type ctrl:DesignerItem}" x:Key="ShapeClassElementStyle" BasedOn="{StaticResource {x:Type ctrl:DesignerItem}}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ctrl:DesignerItem}">
                    <StackPanel Orientation="Horizontal">
                        <StackPanel>
                            <Border Margin="7,7,7,7" Name="BdSelected" BorderBrush="Transparent" BorderThickness="2.0" CornerRadius="8" Padding="1" SnapsToDevicePixels="True">
                                <Border MinWidth="154" Name="Bd" MinHeight="25" Margin="0" BorderBrush="Black" BorderThickness="0.6" CornerRadius="8" Padding="0" SnapsToDevicePixels="True">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                                            <GradientStop Color="#FFE2EDF4"/>
                                            <GradientStop Color="#FFAED0E8" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Expander IsExpanded="{Binding Path=IsExpanded, Mode=TwoWay}" Grid.Row="0">
                                            <Expander.Header>
                                                <Grid Margin="0">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="16"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Image x:Name="ElementImage" Grid.Column="0" Source="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Images/Diagram/shape-16.png"/>

                                                    <ctrl:EditableTextBlock x:Name="DecoratorElementName" MinWidth="100" FontWeight="SemiBold" FontFamily="Tahoma" FontSize="8pt" Margin="5,0,0,0" Grid.Column="1" Text="{Binding Path=DomainElementName, Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                                                    <!--<TextBlock x:Name="DecoratorElementName" FontWeight="SemiBold" FontFamily="Tahoma" FontSize="8pt" Margin="5,0,0,0" Grid.Column="1" Text="{Binding Path=DomainElementName, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Left"/>-->
                                                </Grid>
                                            </Expander.Header>

                                            <!-- COMPARTMENT -->
                                            <ContentControl Margin="0,-3,0,7" x:Name="Compartment" Style="{StaticResource CompartmentStyle}"/>
                                        </Expander>
                                    </Grid>
                                </Border>
                            </Border>
                            <Grid Margin="20,-15,0,0">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="16"/>
                                </Grid.ColumnDefinitions>
                                <Button x:Name="EmbeddingToggleButton" Focusable="False" Width="15" Grid.Column="2" Padding="0" BorderBrush="Transparent" BorderThickness="0" Background="Transparent" Command="{Binding Path=ExpandCollapseCommandTree}">
                                    <Image x:Name="EmbeddingImage" Source="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Images/CollapseSubTree.bmp"/>
                                </Button>
                            </Grid>
                        </StackPanel>

                        <TextBlock VerticalAlignment="Center" Text="{Binding Path=DiagramElementViewModel.DomainElementName, Mode=OneWay}" HorizontalAlignment="Left" Margin="2,0,0,0"/>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <!-- Image displayed trigger -->
                        <DataTrigger Binding="{Binding Path=IsChildrenTreeExpanded}" Value="False">
                            <Setter TargetName="EmbeddingImage" Property="Source" Value="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Images/ExpandSubTree.bmp"/>
                        </DataTrigger>

                        <!-- Toggle button visibility trigger -->
                        <DataTrigger Binding="{Binding Path=HasEmbeddingNodes}" Value="False">
                            <Setter TargetName="EmbeddingToggleButton" Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>

                        <!-- Is selected trigger -->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True">
                            <Setter TargetName="BdSelected" Property="BorderBrush" Value="Black"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- RelationshipShapeElementStyle. -->
    <Style TargetType="{x:Type ctrl:DesignerItem}" x:Key="RelationshipShapeElementStyle" BasedOn="{StaticResource {x:Type ctrl:DesignerItem}}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ctrl:DesignerItem}">
                    <StackPanel Orientation="Horizontal">
                        <StackPanel>
                            <Border Margin="7,7,7,7" Name="BdSelected" BorderBrush="Transparent" BorderThickness="2.0" CornerRadius="8" Padding="1" SnapsToDevicePixels="True">
                                <Border MinWidth="154" Name="Bd" MinHeight="25" Margin="0" BorderBrush="Black" BorderThickness="0.6" CornerRadius="8" Padding="0" SnapsToDevicePixels="True">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                                            <GradientStop Color="#FFF4EFE6"/>
                                            <GradientStop Color="#FFF2D393" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Expander IsExpanded="{Binding Path=IsExpanded, Mode=TwoWay}" Grid.Row="0">
                                            <Expander.Header>
                                                <Grid Margin="0">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="16"/>
                                                        <ColumnDefinition Width="*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Image x:Name="ElementImage" Grid.Column="0" Source="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Images/Diagram/shape_rs-link-16.png"/>
                                                    
                                                    <ctrl:EditableTextBlock x:Name="DecoratorElementName" MinWidth="100" FontWeight="SemiBold" FontFamily="Tahoma" FontSize="8pt" Margin="5,0,0,0" Grid.Column="1" Text="{Binding Path=DomainElementName, Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                                                    <!--<TextBlock x:Name="DecoratorElementName" FontWeight="SemiBold" FontFamily="Tahoma" FontSize="8pt" Margin="5,0,0,0" Grid.Column="1" Text="{Binding Path=DomainElementName, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Left"/>-->
                                                </Grid>
                                            </Expander.Header>

                                            <!-- COMPARTMENT -->
                                            <ContentControl Margin="0,-3,0,7" x:Name="Compartment" Style="{StaticResource CompartmentStyle}"/>
                                        </Expander>
                                    </Grid>
                                </Border>
                            </Border>
                        </StackPanel>

                        <TextBlock VerticalAlignment="Center" Text="{Binding Path=DiagramElementViewModel.DomainElementName}" HorizontalAlignment="Left" Margin="2,0,0,0"/>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <!-- Is selected trigger -->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True">
                            <Setter TargetName="BdSelected" Property="BorderBrush" Value="Black"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- MappingRelationshipShapeElementStyle. -->
    <Style TargetType="{x:Type ctrl:DesignerItem}" x:Key="MappingRelationshipShapeElementStyle" BasedOn="{StaticResource {x:Type ctrl:DesignerItem}}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ctrl:DesignerItem}">
                    <StackPanel Orientation="Horizontal">
                        <StackPanel>
                            <Border Margin="7,7,7,7" Name="BdSelected" BorderBrush="Transparent" BorderThickness="2.0" CornerRadius="8" Padding="1" SnapsToDevicePixels="True">
                                <Border MinWidth="154" Name="Bd" MinHeight="25" Margin="0" BorderBrush="Black" BorderThickness="0.6" CornerRadius="8" Padding="0" SnapsToDevicePixels="True">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                                            <GradientStop Color="#FFE2EDF4"/>
                                            <GradientStop Color="#FFAED0E8" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Expander IsExpanded="{Binding Path=IsExpanded, Mode=TwoWay}" Grid.Row="0">
                                            <Expander.Header>
                                                <Grid Margin="0">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="16"/>
                                                        <ColumnDefinition Width="*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Image x:Name="ElementImage" Grid.Column="0" Source="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Images/Diagram/shape_map-16.png"/>
                                                    <ctrl:EditableTextBlock x:Name="DecoratorElementName" MinWidth="100" FontWeight="SemiBold" FontFamily="Tahoma" FontSize="8pt" Margin="5,0,0,0" Grid.Column="1" Text="{Binding Path=DomainElementName, Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                                                    <!--<TextBlock x:Name="DecoratorElementName" FontWeight="SemiBold" FontFamily="Tahoma" FontSize="8pt" Margin="6,0,0,0" Grid.Column="1" Text="{Binding Path=DomainElementName, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Left"/>-->
                                                </Grid>
                                            </Expander.Header>

                                            <!-- COMPARTMENT -->
                                            <ContentControl Margin="0,-3,0,7" x:Name="Compartment" Style="{StaticResource CompartmentStyle}"/>
                                        </Expander>
                                    </Grid>
                                </Border>
                            </Border>
                        </StackPanel>

                        <TextBlock VerticalAlignment="Center" Text="{Binding Path=DiagramElementViewModel.DomainElementName}" HorizontalAlignment="Left" Margin="2,0,0,0"/>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <!-- Is selected trigger -->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True">
                            <Setter TargetName="BdSelected" Property="BorderBrush" Value="Black"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>